import 'package:extended_image/extended_image.dart';
import 'package:flutter/material.dart';
import 'package:flutterlib/common/config/config.dart';
import 'package:flutterlib/common/style/font_awesome4_icons.dart';
import 'package:flutterlib/common/style/meterial_design_icons.dart';
import 'package:flutterlib/common/style/quhui_style.dart';
import 'package:flutterlib/common/utils/navigator_utils.dart';
import 'package:flutterlib/model/post/post_bean.dart';
import 'package:flutterlib/widgets/bussiness/user_info_widget.dart';
import 'package:like_button/like_button.dart';

class CardListItem extends StatelessWidget {
  final PostBean postBean;

  final VoidCallback onPressed;

  CardListItem(this.postBean,
      {this.onPressed,
      })
      : super();

  @override
  Widget build(BuildContext context) {
    if (postBean != null ) {
      return normalItem(context);
    }
  }


  Widget normalItem(BuildContext context) => Padding(
        padding: const EdgeInsets.only(left: 10, right: 10, top: 8, bottom: 16),
        child: InkWell(
          splashColor: Colors.transparent,
          onTap: () {
            onPressed();
          },
          child: Container(
            decoration: BoxDecoration(
              borderRadius: const BorderRadius.all(Radius.circular(10.0)),
              boxShadow: <BoxShadow>[
                BoxShadow(
                  color: Colors.grey.withOpacity(0.6),
                  offset: const Offset(4, 4),
                  blurRadius: 16,
                ),
              ],
            ),
            child: ClipRRect(
              borderRadius: const BorderRadius.all(Radius.circular(10.0)),
              child: Column(
                children: <Widget>[
                  AspectRatio(
                    aspectRatio: 2,
                    child: Stack(
                      fit: StackFit.expand,
                      children: [
                        ExtendedImage.network(
                          postBean.thumbnail,
                          fit: BoxFit.cover,
                        ),
                        Positioned(
                          left: 10,
                          top: 10,
                          child: Row(
                            children: [
                              UserInfoWidget(
                                width: 33,
                                height: 33,
                                image: postBean.userLogo,
                                onPressed: () {
                                  NavigatorUtils.goUserHome(
                                      context, postBean.userId);
                                },
                              ),
                              Text(
                                postBean.userName,
                                style: QuhuiConstant.smallTextWhite,
                              ),
                            ],
                          ),
                        ),
                      ],
                    ),
                  ),
                ],
              ),
            ),
          ),
        ),
      );


}
